<template>
  <div>
<table>
  <tr>
    <td>项目名称</td>
    <td><input type="text" v-model="addData.Mname"></td>
  </tr>
  <tr>
    <td>最低金额</td>
    <td><input type="text" v-model="addData.SlotMoney"></td>
  </tr>
  <tr>
    <td>风险等级</td>
    <td><input type="text" v-model="addData.Mtop"></td>
  </tr>
  <tr>
    <td colspan="2"><input type="button" value="提交" @click="add"></td>
  </tr>
</table>
  </div>
</template>

<script setup lang="ts">

import { reactive,toRefs } from 'vue';
import { useRouter } from 'vue-router';
let rounter = useRouter();

import axios from 'axios';

let data = reactive({
  addData:{
    Mname:'',
    SlotMoney:'',
    Mtop:''
  }
})

let { addData } = toRefs(data);


const add=()=>{
  axios({
    url:'http://localhost:50370/api/Money/PostAdd',
    method:'post',
    data:{
      Mname:addData.value.Mname,
      SlotMoney:addData.value.SlotMoney,
      Mtop:addData.value.Mtop
    }
  }).then(res=>{
if(res.data>0){
  alert("添加成功");
  rounter.push("/show");
}else{
  alert("添加失败");
}
  }).catch(err=>{

  })
}

</script>

<style scoped>

</style>